package com.zhu.char06

/**
 *
 * @version 1.0
 * @author study
 * @date 2020/9/5 11:59
 *
 */
object Scala_Trait {
  def main(args: Array[String]): Unit = {

    var a:PersonTrait17=new Myclass17
    println(a.name)
  }
}

trait PersonTrait17 {
  //抽象属性
  var name: String

  //抽象方法
  def eat(): Unit

  //非抽象属性
  var age: Int = 10

  def sleep(): Unit = {
    println("person`s sleep")
  }
}

class Myclass17 extends PersonTrait17 {
  override var name: String = "特质"

  override def eat(): Unit = {

  }
}
